package com.sali.design_pattern.d_strategy_pattern.lesson_03.enums;

import com.sali.design_pattern.d_strategy_pattern.lesson_03.strategy.IMyOperatorStrategy;
import com.sali.design_pattern.d_strategy_pattern.lesson_03.strategy.StrategyAOperator;
import com.sali.design_pattern.d_strategy_pattern.lesson_03.strategy.StrategyBOperator;

/**
 * @description:
 * @date: 2024/1/6 11:04.
 * @version: 1.0
 */
public enum StrategyOperatorEnum {

    StrategyA(StrategyAOperator.class),
    StrategyB(StrategyBOperator.class);

    private Class<? extends IMyOperatorStrategy> clazz;

    StrategyOperatorEnum(Class<? extends IMyOperatorStrategy> clazz) {
        this.clazz = clazz;
    }

    public Class<? extends IMyOperatorStrategy> getClazz() {
        return clazz;
    }

    public static Class<? extends IMyOperatorStrategy> getClazz(String name) {
        return StrategyOperatorEnum.valueOf(name).getClazz();
    }

}
